﻿using Main.Models;
using Main.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Main.UIServices
{
  public  class DbProcessing
    {
        ISalaryService service;
        public DbProcessing()
        {
            service = new SalaryService();
        }
        public async Task<List<SalaryItem>> QueryAsync(DateTime Time)
        {
            int  mounthIndex= (Time.Year - 2015) * 12 + (Time.Month - 7);
            return await service.QueryAsync(mounthIndex, mounthIndex);

        }
        public async Task<List<SalaryItem>> QueryAsync(DateTime Start,DateTime End)
        {
            int StartMounthIndex = (Start.Year - 2015) * 12 + (Start.Month - 7);
            int EndMounthIndex = (End.Year - 2015) * 12 + (End.Month - 7);

            return await service.QueryAsync(StartMounthIndex, EndMounthIndex);
        }

    }
}
